package GameEngine.Drawables.GameObjects;

import GameEngine.helper.PAppletBridge;
import processing.core.PImage;

public class Mountain {

	public int direction = -1;

	// Anfang Berge
	RandomBerg rb;
	PImage berg;
	PImage berg1;
	PImage berg2;
	int bx = 0;
	int bx1 = 0;
	int bx2 = 0;
	int speed = 1;
	int speed1 = 2;
	int speed2 = 3;

	public Mountain() {
		rb = new RandomBerg();

		// Bergbilder
		berg = rb.getImage(0xffF755ED);
		berg1 = rb.getImage(0xffABCDEF);
		berg2 = rb.getImage(0xff1278EF);
	}

	public void drawBerge() {
		PAppletBridge.imageMode(PAppletBridge.CORNER);

		bx += direction * speed;
		bx1 += direction * speed1;
		bx2 += direction * speed2;

		PAppletBridge.pushMatrix();
		PAppletBridge.translate(bx, 100 - 100);
		drawBerg(berg, 0, 0);
		PAppletBridge.popMatrix();

		PAppletBridge.pushMatrix();
		PAppletBridge.translate(bx1, 130 - 100);
		drawBerg(berg1, 0, 0);
		PAppletBridge.popMatrix();

		PAppletBridge.pushMatrix();
		PAppletBridge.translate(bx2, 200 - 120);
		drawBerg(berg2, 0, 0);
		PAppletBridge.popMatrix();
	}

	public void drawBerg(PImage brg, int bx, int by) {
		for (int i = -15; i < 16; i++) {
			PAppletBridge.imageMode(PAppletBridge.CORNERS);
			PAppletBridge.image(brg, bx + (i * 2000), by);
		}
	}

	// Getter und Setter
	
	public void setDirection(int direction) {
		this.direction = direction;
	}


}
